fix: allways allow duplicaiton - #8689
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Found #8421 that implements duplication for read-only events. |
109d443 to
8e27ba0
Compare
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
8e27ba0 to
b7c80d9
Compare
| @@ -646,7 +646,7 @@ export default { | |||
| keyboardDuplicateEvent(event) { | |||
| if (event.key === 'd' && event.ctrlKey === true) { | |||
There was a problem hiding this comment.
note(non-blocking): Shortcuts do not work as expect under MacOS
We should use https://nextcloud-vue-components.netlify.app/#/Composables/useHotKey
Created #8715
| if (event.key === 'd' && event.ctrlKey === true) { | ||
| event.preventDefault() | ||
| if (!this.isNew && !this.isReadOnly && !this.canCreateRecurrenceException) { | ||
| if (!this.isNew && !this.canCreateRecurrenceException) { |
There was a problem hiding this comment.
issue: Inconsistent/outdated check for !this.canCreateRecurrenceException.
Overview of current checks:
EditorMixin.keyboardDuplicateEvent:!this.isNew && !this.canCreateRecurrenceExceptionEditFull.vue:!isNew(checked on action)EditSimple.vue:!isNew(checked on action container)
Might worth introducing EditorMixin.canDuplicate to avoid accidental drift.
| {{ $t('calendar', 'Export') }} | ||
| </NcActionLink> | ||
| <NcActionButton v-if="!canCreateRecurrenceException && !isReadOnly && !isNew" @click="duplicateEvent()"> | ||
| <NcActionButton v-if="!isNew" @click="duplicateEvent()"> |
There was a problem hiding this comment.
issue: Duplicate action is available in embedded view (apps/calendar/embed/...) and has no effect.
| {{ $t('calendar', 'Export') }} | ||
| </NcActionLink> | ||
| <NcActionButton v-if="!canCreateRecurrenceException && !isReadOnly && !isNew" @click="duplicateEvent()"> | ||
| <NcActionButton v-if="!isNew" @click="duplicateEvent()"> |
There was a problem hiding this comment.
issue: Duplicate action is available in public view (/apps/calendar/p/...) and has no effect.
| const calendarId = this.isReadOnly | ||
| ? (this.calendarsStore.sortedCalendars[0]?.id ?? null) | ||
| : (this.calendarObject?.calendarId ?? null) | ||
| await this.calendarObjectInstanceStore.duplicateCalendarObjectInstance({ calendarId }) |
There was a problem hiding this comment.
issue: We should abort (with a warning), if calendarId === null aka. no writable target calendar exists.
Or maybe even dont show that duplicate action to the user, if no writable target calendar exists.
Could be part ofEditorMixin.canDuplicate (suggested in https://github.com/nextcloud/calendar/pull/8689/changes#r3754176914)
Such a check would automatically resolve:
| timezoneId: oldEventComponent.startDate.timezoneId, | ||
| isAllDay: oldEventComponent.isAllDay(), | ||
| calendarId: this.calendarObject?.calendarId ?? null, | ||
| calendarId: calendarId ?? this.calendarObject?.calendarId ?? null, |
There was a problem hiding this comment.
nit: this.calendarObject?.calendarId might be of a read only calendar. Let's make calendarId mandatory.
Relates to https://github.com/nextcloud/calendar/pull/8689/changes#r3754267389
Summary